#include <stdio.h>
#include <stdlib.h>

typedef struct linklist{
	int no;
	struct linklist* next;
}list;

int main(){
	list* head=(list*)malloc(sizeof(list));;
	head->no=1;
	list* current=head;
	list* temp;
	
	//init circut linklist
	int i;
	for(i=2;i<14;i++){
		temp=(list*)malloc(sizeof(list));
		temp->no=i;
		current->next=temp;
		current=temp;
	}
	current->next=head;
	
	int c=1;
	list* pre;
	for(temp=head;1;pre=temp,temp=temp->next){
		if(c==3){
			printf("quit:%d\n",temp->no);
			if(pre==temp->next){
				break;
			}
			pre->next=temp->next;
			c=0;
		}
		c++;
	}
	
	printf("last :%d\n",pre->no);
}